<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width,initial-scale=1 user-scalable=0">
<title>搜索结果</title>
<link rel="stylesheet" href="<%=basePath%>assets/css/public.css">
<link rel="stylesheet" href="<%=basePath%>assets/css/swiper.min.css">
<link rel="stylesheet" href="<%=basePath%>assets/css/page.css">
<link rel="stylesheet"
	href="<%=basePath%>assets/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="<%=basePath%>assets/js/jquery-1.8.3.min.js"></script>
<script src="<%=basePath%>assets/js/fontSize.js"></script>
<script src="<%=basePath%>assets/js/swiper.min.js"></script>

<style>
body {
	padding-top: 0.8rem;
}

.header {
	background: #f8f8f8;
}

.search {
	width: 65%;
	border-bottom: 1px solid #f1f1f1;
	border-radius: 0.05rem;
	height: 0.6rem;
	line-height: 0.6rem;
	background: #FFFFFF url(<%=basePath%>assets/imgMenu/ss.png) no-repeat
		0.1rem 0.1rem;
	background-size: 0.4rem 0.4rem;
	padding-left: 0.6rem;
	font-size: 0.24rem;
	position: relative;
}

.content_cont ul li {
	padding: 3%;
	border-bottom: 1px solid #f1f1f1
}

.img {
	width: 19%;
	float: left;
	margin: 2% 1% 2% 2%
}

.goodsInfo {
	width: 72%;
	float: right;
	margin: 2% 2% 2% 1%;
	height: 1.14rem;
	position: relative
}

.goodsName {
	font-size: 0.26rem;
	line-height: 0.4rem;
	font-weight: bold;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.price {
	width: 100%;
	color: red;
	font-size: 0.2rem;
	position: absolute;
	left: 0;
	bottom: 0
}

.content_cont ul li {
	width: 94%;
	padding: 0 3%;
	border-bottom: 1px solid #f1f1f1
}

.shangjiaxinxi {
	width: 100%;
	padding: 3% 0
}

.shangjiaxinxi>img {
	width: 10%;
	border-radius: 10%;
	float: left
}

.shangjiatext {
	width: 87%;
	float: right;
	line-height: 0.4rem;
}

.shangjiatext_dianpuming {
	font-size: 0.3rem;
	height: 0.36rem;
	line-height: 0.36rem;
}

.shangjiatext_gengxinshijian {
	font-size: 0.23rem;
	height: 0.26rem;
	line-height: 0.26rem;
	color: #ccc
}

.jiage {
	color: red;
	font-size: 0.24rem;
	height: 0.4rem;
	line-height: 0.4rem;
	padding-right: 0.3rem;
}

.yuanjia {
	color: #ccc;
	font-size: 0.18rem;
	height: 0.4rem;
	line-height: 0.4rem;
	padding-right: 0.5rem;
	text-decoration: line-through
}

.shangpinxinxi {
	font-size: 0.22rem;
	line-height: 0.4rem;
	font-weight: bold;
	font-size: 14px;
	margin: 10px 0
}

.zhanshitupian {
	height: 2rem
}

.swiper-container {
	width: 100%;
	height: 100%;
}

.swiper-slide {
	text-align: center;
	font-size: 18px;
	background: #fff;
	/* Center slide text vertically */
	display: -webkit-box;
	display: -ms-flexbox;
	display: -webkit-flex;
	display: flex;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	-webkit-justify-content: center;
	justify-content: center;
	-webkit-box-align: center;
	-ms-flex-align: center;
	-webkit-align-items: center;
	align-items: center;
}

.swiper-slide img {
	width: 100%;
	height: 100%
}

.noSJ {
	width: 100%;
	height: 8rem;
}

.noSJ img {
	width: 50%;
	margin: 10% auto;
	display: block
}

.noSJ h3 {
	width: 100%;
	font-size: 0.25rem;
	line-height: 0.6rem;
	font-weight: bold;
	text-align: center
}

.noSJ p {
	width: 100%;
	font-size: 0.24rem;
	line-height: 0.6rem;
	text-align: center
}
</style>

</head>
<body>
	<input id="basePath" type="hidden" value="<%=basePath%>">
	<div class="header clearFirx">
		<a class=returnInfo href="#" id="fanhui"><i class="fa fa-angle-left"></i></a>
		<input id="content" type="text" placeholder="搜索" class="search"
			value="${content}"
			onfocus="window.location.href='<%=basePath%>jsp/app/searchTwoHand.jsp'">
	</div>
	<c:choose>
		<c:when test="${not empty usedGoodsList}">
			<div class="content_cont">
				<ul>
					<c:forEach items="${usedGoodsList}" var="item">
						<li><a
							href="<%=basePath%>app/getUsedGoodsInfo?goodsId=${item.goodsId}">
								<div class="shangjiaxinxi clearFirx">
									<img src="<%=basePath%>/app/getGoodsPhotoByName?goodsImage=${item.userPhoto}" alt="">
									<div class="shangjiatext">
										<div style="float: left;">
											<p class="shangjiatext_dianpuming">${item.userName}</p>
											<p class="shangjiatext_gengxinshijian">
												<fmt:formatDate value='${item.createDate}'
													pattern='yyyy-MM-dd HH:mm' />
											</p>
										</div>
										<div
											style="float: right; color: red; font-weight: bold; font-size: 14px">
											￥${item.goodsPrice}</div>
									</div>
								</div>
								<div class="zhanshi">
									<div class="zhanshitupian">
										<div class="swiper-container">
											<div class="swiper-wrapper">
												<c:forTokens items="${item.goodsImage}" delims=","
													var="imgPath">
													<div class="swiper-slide" style="margin-right: 5px">
														<img
															src="<%=basePath%>/app/getGoodsPhotoByName?goodsImage=${imgPath}"
															alt="">
													</div>
												</c:forTokens>
											</div>
										</div>
										<script>
											var swiper = new Swiper(
													'.swiper-container', {
														slidesPerView : 3.5,
														spaceBetween : 5,
														pagination : {
															clickable : true,
														},
													});
										</script>

									</div>
								</div>
								<div class="shangpinxinxi">${item.goodsIntro}</div>
						</a></li>
					</c:forEach>

				</ul>
			</div>
		</c:when>
		<c:otherwise>
			<div class="noSJ">
				<img src="<%=basePath%>assets/images/bcz.png" alt="">
				<h3>没有搜到您想要的宝贝</h3>
				<p>换个关键词试试</p>
			</div>
		</c:otherwise>
	</c:choose>
</body>
<script type="text/javascript">
	$(function() {
		var obj = "${usedGoodsList}";
		if (obj == "[]") {
			$(".noSJ").css("display", "block");
		}
		$('#ul').find('li').each(function() {
			$(this).find('a>img').height($(this).find('a>img').width())
		});

		$('.shangjiaxinxi>img').height($('.shangjiaxinxi>img').width());

		//点击返回
		$("#fanhui").click(function() {
			window.location.href = "javascript:history.go(-2)";
		});
	})
</script>
</html>